﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="BindingScript">
    <xs:complexType>
      <xs:complexContent mixed="false">
        <xs:extension base="CubicleScript">
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="CommandSource" type="ArrayOfCommandDescription" />
            <xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="FunctionSource" type="ArrayOfFunctionDescription" />
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="CubicleScript">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Dict" type="ArrayOfCubicleScriptItem" />
      <xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Instructions" type="ArrayOfCubicleScriptInstruction" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ArrayOfCubicleScriptItem">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="Item">
        <xs:complexType>
          <xs:attribute name="key" type="xs:string" />
          <xs:attribute name="value" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ArrayOfCubicleScriptInstruction">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="Instruction">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="ClassArgs">
              <xs:complexType>
                <xs:attribute name="className" type="xs:string" />
              </xs:complexType>
            </xs:element>
            <xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="MethodArgs">
              <xs:complexType>
                <xs:attribute name="className" type="xs:string" />
              </xs:complexType>
            </xs:element>
            <xs:element minOccurs="0" maxOccurs="unbounded" name="p">
              <xs:complexType>
                <xs:attribute name="c" type="xs:int" use="required" />
                <xs:attribute name="row" type="xs:int" use="required" />
                <xs:attribute name="handle" type="xs:string" />
                <xs:attribute name="key" type="xs:string" />
                <xs:attribute name="value" type="xs:string" />
                <xs:attribute name="type" type="xs:string" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="memberName" type="xs:string" />
          <xs:attribute name="key" type="xs:string" />
          <xs:attribute name="handle" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ArrayOfCommandDescription">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="ExcelCommand">
        <xs:complexType>
          <xs:complexContent mixed="false">
            <xs:extension base="BaseDescription">
              <xs:attribute name="menuName" type="xs:string" />
              <xs:attribute name="menuText" type="xs:string" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="BaseDescription" abstract="true">
    <xs:attribute name="bindMethod" type="BindMethodEnum" use="required" />
    <xs:attribute name="target" type="xs:string" />
    <xs:attribute name="methodName" type="xs:string" />
    <xs:attribute name="methodOffset" type="xs:int" use="required" />
    <xs:attribute name="functionName" type="xs:string" />
    <xs:attribute name="prefix" type="xs:string" />
    <xs:attribute name="postfix" type="xs:string" />
    <xs:attribute name="description" type="xs:string" />
    <xs:attribute name="isExceptionSafe" type="xs:boolean" use="required" />
    <xs:attribute name="resolveParameter" type="xs:boolean" use="required" />
  </xs:complexType>
  <xs:simpleType name="BindMethodEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="object" />
      <xs:enumeration value="handle" />
      <xs:enumeration value="directStatic" />
      <xs:enumeration value="indirectStatic" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ArrayOfFunctionDescription">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="ExcelFunction">
        <xs:complexType>
          <xs:complexContent mixed="false">
            <xs:extension base="BaseDescription">
              <xs:attribute name="isHidden" type="xs:boolean" use="required" />
              <xs:attribute name="isThreadSafe" type="xs:boolean" use="required" />
              <xs:attribute name="category" type="xs:string" />
              <xs:attribute name="isVolatile" type="xs:boolean" use="required" />
              <xs:attribute name="isMacroType" type="xs:boolean" use="required" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>